# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Contributor: fossdd <fossdd@pwned.life>
# Maintainer: fossdd <fossdd@pwned.life>
pkgname=py3-websockets
_pkgname=websockets
pkgver=13.1
pkgrel=0
pkgdesc="An implementation of the WebSocket Protocol (RFC 6455)"
url="https://websockets.readthedocs.io/"
arch="all"
license="BSD-3-Clause"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/aaugustin/websockets/archive/$pkgver.tar.gz
	skip-reconnect-test.patch
	"
builddir="$srcdir"/$_pkgname-$pkgver
options="!check" # fail for now with context manager errors

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	export WEBSOCKETS_TESTS_TIMEOUT_FACTOR=30
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
f66c25c8c2a327840e424e1db3742f1e303df562fe59e91d44c15731d9e43d3d9b126253f2ffb2efeada63d3fd8b404480506554f263846d8d0d86da02f4d8aa  py3-websockets-13.1.tar.gz
0849fa337f6a00297774cc3a3dd61497bbc99dc3b12632a385056a82e50fd04bf057068eeef6f9b705c257e3017b127ee38183461615d09549145889767bdc0b  skip-reconnect-test.patch
"
